#
#Copyright (c) 2024 Black Sesame Technologies
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
#

CFLAGS += -I $(PWD)/ipc_msgbox/ipc_trans_layer/include
CFLAGS += -I $(PWD)/ipc_msgbox/ipc_trans_layer/src
CFLAGS += -I $(PWD)/ipc_msgbox/ipc_sem_layer
CFLAGS += -I $(PWD)/ipc_msgbox/ipc_hw_layer/include
CFLAGS += -I $(PWD)/ipc_msgbox/ipc_hw_layer/msgbx
CFLAGS += -I $(PWD)/ipc_msgbox/config
CFLAGS += -I $(PWD)/ipc_msgbox/switch0-canoe-client/src-gen
CFLAGS += -I $(PWD)/ipc_msgbox/switch0-can-gateway-serverr/src-gen

VPATH=./ipc_trans_layer/src:\
	  ./ipc_hw_layer:\
	  ./ipc_sem_layer:\
	  ./ipc_hw_layer/msgbx:\
	  ./sample-client/src-gen:\
	  ./sample-server/src-gen:
	
VPATH += ./switch0-canoe-client/src-gen:./switch0-can-gateway-server/src-gen


SOURCES = $(OBJ_DIR)/ipc_trans_impl.c
SOURCES += $(addprefix $(OBJ_DIR)/, $(notdir $(wildcard ./ipc_trans_layer/src/*.c)))
SOURCES += $(OBJ_DIR)/ipc_hw_layer.c
SOURCES += $(OBJ_DIR)/msgbx.c
SOURCES += $(OBJ_DIR)/ipc_hw_sem.c



SOURCES += $(OBJ_DIR)/switch0_can_gateway_ipc_server.c
SOURCES += $(OBJ_DIR)/switch0_can_gateway_server.c
SOURCES += $(OBJ_DIR)/switch0_canoe_ipc_client.c
SOURCES += $(OBJ_DIR)/switch1_canoe_client.c


OBJS  = $(patsubst %.c,%.o,$(SOURCES))

$(info $$SOURCES is [${SOURCES}])
$(info $$OBJS is [${OBJS}])

all: $(OBJS)


$(OBJ_DIR)/%.o: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^

